package com.ssfk.service.impl;

import com.ssfk.framework.service.JSONResponse;
import com.ssfk.framework.utils.KeyConst;
import com.ssfk.service.JSONStatement;
import com.ssfk.service.StatementService;
import com.ssfk.service.mybatis.mapper.StatementMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by yuanjie on 2016/9/5.
 */
public class StatementServiceImpl implements StatementService, KeyConst {
    @Autowired
    private StatementMapper mapper;

    @Override
    public JSONResponse executeStatment(JSONStatement statement) {
        StatementEngine engine = new StatementEngine(mapper);
        if (null != statement.getName() && !statement.getName().isEmpty()) {
            statement.put(KEY_STATEMENT, statement.getName());
        }
        return engine.execute(statement);
    }
}
